Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

help-version

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

help-version

Easily handle --help and --version arguments in your CLI application

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-21.74%
Maintainers
1
Weekly downloads
 
Created
Source

npm

help-version

Build Status Dependency Status

Automatic handling of --help and --version arguments for CLI applications.

Example

#!/usr/bin/env node

var helpVersion = require('help-version')(usage());

function usage() {
  return 'Usage:  my-app [file]';
}

helpVersion.version()
//=> "v0.1.0"

console.log('main thing');

Catches --help and --version automatically.

$ ./app.js --help
Usage:  my-app [file]
$ ./app.js --version
v0.1.0
$ ./app.js
main thing

API

helpVersion = require('help-version')(help, [version])

Checks process.argv for --help or --version, prints help or version if found one.

version defaults to version field from your local package.json.

helpVersion.help([code], [stream])

With no arguments, returns the help string.

With one or two arguments, writes help to the stream and exits with code. stream defaults to process.stdout if code==0 and process.stderr otherwise.

helpVersion.version([code], [stream])

Returns version string or writes it to stream and exits.

Install

npm install help-version

License

MIT

Keywords

FAQs

Package last updated on 23 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc